<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div id="inner"></div>
<script type="text/javascript">
//模板渲染的原理相当于用一个数据替换原来的存在的
var inner = '<div>Hi {{username}}</div>'
var username = "hcc"
var res = inner.replace("{{username}}",username)
console.log(res)
var divs = document.getElementById("inner")
divs.innerHTML = res
</script>
</body>
</html>